﻿@model PublishNews.Models.CreateNewsModel

@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="col-md-6" ng-controller="myController">
    @if (Model.Succeeded)
    {
        <div>News is published</div>
    }
    else
    {
        <h2>Create</h2>

        using (Html.BeginForm("Create", "News", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
        <div class="form-group">
            @Html.LabelFor(model => model.Title)
            @Html.TextBoxFor(model => model.Title, new { @class = "form-control" })
            @Html.ValidationMessageFor(model => model.Title)
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.Content)
            @Html.TextAreaFor(model => model.Content, new { @class = "form-control content-news" })
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.LocationId)
            @Html.HiddenFor(model => model.LocationId, new { @class = "form-control location-hidden" })
            <select class="form-control" ng-model="myLocation" ng-options="location.name for location in locations">
            </select>
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.CategoryId)
            @Html.HiddenFor(model => model.CategoryId, new { @class = "form-control categoryId-hidden" })
            <select class="form-control" ng-model="myCategory" ng-options="category.name for category in categories">
            </select>
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.PhoneNumber)
            @Html.TextBoxFor(model => model.PhoneNumber, new { @class = "form-control" })
            @Html.ValidationMessageFor(model => model.PhoneNumber)
        </div>
       
        <input type="submit" class="btn btn-primary submit" name="submit" value="Submit" />
        }
    }

    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>

</div>

<!-- /.modal -->
@section css{
    <link rel="stylesheet" href="/Content/themes/css/angular.treeview.css" />
}

@section scripts
{
    <script type="text/javascript" src="/Scripts/nicEdit.js"></script>
    <script type="text/javascript" src="/Scripts/angular.treeview.js"></script>
    <script type="text/javascript" src="/Scripts/app/addnews.js"></script>
}

